import AppLayout from '@/layout/AppLayout.vue';
import { createRouter, createWebHistory } from 'vue-router';

const router = createRouter({
    history: createWebHistory(),
    routes: [
        {
            path: '/',
            component: AppLayout,
            children: [
                {
                    path: '',
                    redirect: '/tooldashboard'
                },
                {
                    path: '/tooldashboard',
                    name: 'tooldashboard',
                    component: () => import('@/views/ToolDashboard.vue')
                },
                {
                    path: '/customtools/char',
                    name: 'char',
                    component: () => import('@/views/customtools/Char.vue'),
                    props: (route) => ({
                        id: route.params.id
                    })
                },
                {
                    path: '/customtools/char/tools',
                    name: 'charTools',
                    component: () => import('@/views/customtools/char/num2binary.vue'),
                    props: (route) => ({
                        id: route.params.id
                    })
                },
                {
                    path: '/customtools/convert',
                    name: 'convert',
                    component: () => import('@/views/customtools/Convert.vue'),
                    props: (route) => ({
                        id: route.query.id
                    })
                },
                {
                    path: '/customtools/encrypt',
                    name: 'encrypt',
                    component: () => import('@/views/customtools/Encrypt.vue'),
                    props: (route) => ({
                        id: route.query.id
                    })
                },
                {
                    path: '/customtools/network',
                    name: 'network',
                    component: () => import('@/views/customtools/Network.vue'),
                    props: (route) => ({
                        id: route.query.id
                    })
                }
            ]
        },

        {
            path: '/landing',
            name: 'landing',
            component: () => import('@/views/pages/Landing.vue')
        },
        {
            path: '/pages/notfound',
            name: 'notfound',
            component: () => import('@/views/pages/NotFound.vue')
        },

        {
            path: '/auth/login',
            name: 'login',
            component: () => import('@/views/pages/auth/Login.vue')
        },
        {
            path: '/auth/access',
            name: 'accessDenied',
            component: () => import('@/views/pages/auth/Access.vue')
        },
        {
            path: '/auth/error',
            name: 'error',
            component: () => import('@/views/pages/auth/Error.vue')
        }
    ]
});

export default router;